﻿namespace NEvoWeb.Modules.NB_Store
{
    using Microsoft.VisualBasic.CompilerServices;
    using System;
    using System.IO;
    using System.Runtime.InteropServices;
    using System.Text;

    public class FileObj
    {
        public string GetFileContents(string FullPath, ref string ErrInfo = "")
        {
            try
            {
                StreamReader reader = new StreamReader(FullPath, Encoding.UTF8);
                string str2 = reader.ReadToEnd();
                reader.Close();
                return str2;
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                ErrInfo = exception.Message;
                ProjectData.ClearProjectError();
            }
            return "";
        }

        public bool SaveTextToFile(string strData, string FullPath, string ErrInfo = "")
        {
            bool flag = false;
            try
            {
                StreamWriter writer = new StreamWriter(FullPath, false, Encoding.UTF8);
                writer.Write(strData);
                writer.Close();
                flag = true;
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                ErrInfo = exception.Message;
                ProjectData.ClearProjectError();
            }
            return flag;
        }
    }
}

